﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TreeTraversal
{
    public partial class LabeledTextBox : UserControl
    {
        public LabeledTextBox()
        {
            InitializeComponent();
            textBoxRandomSeed.GotFocus += textBoxRandomSeed_GotFocus;
            textBoxRandomSeed.LostFocus += textBoxRandomSeed_LostFocus;
        }

        //[Description("The text associated with the control."),
        // Category("Appearance"),
        // DefaultValue(""),
        // Browsable(true)]
        [EditorBrowsable(EditorBrowsableState.Always), Browsable(true),
         DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public override string Text
        {
            get
            {
                return label4.Text;
            }
            set
            {
                label4.Text = value;
            }
        }

        bool m_HasFocus = false;
        void textBoxRandomSeed_LostFocus(object sender, EventArgs e)
        {
            m_HasFocus = false;
            label4.BackColor = System.Drawing.SystemColors.Control;
        }

        void textBoxRandomSeed_GotFocus(object sender, EventArgs e)
        {
            m_HasFocus = true;
            //Color.FromArgb(0x11, Color.Black);
            label4.BackColor = Color.FromArgb(0x55, Color.Turquoise);
        }

        private void textBoxRandomSeed_MouseEnter(object sender, EventArgs e)
        {
            if (!m_HasFocus)
            {
                Color temp;
                temp = Color.FromArgb(0x55, Color.Turquoise);
                //temp = Color.FromArgb(0x11, Color.Black);
                label4.BackColor = temp;
            }
        }

        private void textBoxRandomSeed_MouseLeave(object sender, EventArgs e)
        {
            if (!m_HasFocus)
            {
                label4.BackColor = System.Drawing.SystemColors.Control;
            }
        }
    }
}
